﻿using Microsoft.AspNetCore.Mvc;
using web_api_demo101.Services.Impl;

namespace web_api_demo101.Controllers;


[ApiController]
[Route("[controller]")]
public class UserController : ControllerBase
{
    private readonly UserService _userService;
    public UserController()
    { 
        _userService = new UserService();
    }


    [HttpGet(Name = "Info")]
    public IActionResult Info(int id)
    { 
        var target = _userService.GetById(id);
        //return Json(target);
        //return Ok(target);
        return new JsonResult(target);
    }
}
